package com.zhanggm.springboot.springbootdemo05.service;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;

@Service
public class OrderService {
    private Logger logger = LoggerFactory.getLogger(getClass());

    public void addOrder(){
        logger.info("下单成功");
    }

    public void pay(){
        logger.info("支付成功");
    }

    public void cannelOrder(){
        try {
            Thread.sleep(500);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        logger.info("取消订单成功");
    }

    @Async
    public void sendMsg(){
        try {
            Thread.sleep(500);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        logger.info("发送短信成功");
    }
    @Async
    public void sendEmail(){
        try {
            Thread.sleep(500);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        logger.info("发送邮件成功");
    }
}
